<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        for (var i = 1; i <= 10; i++) {
            for (var b = 1; b <= 10 - i; b++) {
                document.write("&nbsp;&nbsp;");
            }
            for (var a = 1; a <= i * 2 - 1; a++) {
                document.write("8");
            }

            document.write("<br>")
        }
        for (var i = 9; i > 0; i--) {
            for (var b = 9; b >= i; b--) {
                document.write("&nbsp;&nbsp;");
            }
            for (var a = 1; a <= i * 2 - 1; a++) {
                document.write("8");
            }
            document.write("<br>")
        }
    </script>
</body>

</html>